package com.bjsxt.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EchoController {

    @Value("${server.port}")
    private Integer port ; // 在一台主机上启动多个服务提供者，它的端口肯定不同
    /**
     * reply message
     * @param message
     * @return
     */
    @GetMapping("/echo/{message}")
    public ResponseEntity<String> echo(@PathVariable("message")String message){

        return ResponseEntity.ok(String.format("hello,%s,我是%s",message,port)) ;

    }
}
